//
//  GXPlayView.m
//  SXH
//
//  Created by 龚啸 on 16/1/28.
//  Copyright © 2016年 lyss. All rights reserved.
//

#import "GXPlayView.h"
#import "UIImageView+WebCache.h"
#import "CommonService.h"
@implementation GXPlayView
+(instancetype)sharedInstance {
    
    static GXPlayView *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[self alloc]init];
//       
    });
    
    return instance;
}
- (id)init
{
    if ( self = [super init] )
    {
        self = [[[NSBundle mainBundle] loadNibNamed:@"GXPlayView" owner:self options:nil]lastObject];
        self.viewCor.layer.cornerRadius = 10.0;
        [self.viewCor.layer setMasksToBounds:YES];
        self.viewCor.clipsToBounds = YES;
    }
    return self;
}
-(void)setEntity:(SpotEntity *)entity
{
    _entity = entity;
    _title.text = entity.title;
    NSString *localImagePath = [CommonService addLocalRootPath:entity.album1 ParkId:_parkEntity.ID];
    _viewImage.image = [UIImage imageWithContentsOfFile:localImagePath];
    if ([entity.is_recommend isEqualToString:@"1"]) {
        _recomendIcon.hidden = NO;
    }else{
        _recomendIcon.hidden = YES;
    }
}
- (IBAction)btnStopAction:(id)sender {
    _btnStopBlock();
}
- (IBAction)btnPlayAction:(id)sender {
    _btnPlayBlock();
}
- (IBAction)navigationAction:(id)sender {
    _btnNavigationBlock();
}
- (IBAction)contentPlayAction:(id)sender {
    _btnContentPlayBlock();
}
- (IBAction)closeAction:(id)sender {
    _btnCloseBlock();
}

-(void)doStopActionWithBlock:(btnStopBlock)blockStop doPlayActionWithBlock:(btnPlayBlock)blockPlay doNavigationActionWithBlock:(btnNavigationBlock)blockNavigation doCloseWithBlock:(btnCloseBlock)blockClose doContentPlayActionWithBlock:(btnContentPlayBlock)blockContent
{
    _btnCloseBlock = blockClose;
    _btnContentPlayBlock = blockContent;
    _btnPlayBlock = blockPlay;
    _btnStopBlock = blockStop;
    _btnNavigationBlock = blockNavigation;
}
@end
